import { ICodeListItem, IContext, IParam } from '@/core';
import type { PropType } from 'vue';

export const quickGroupProps = {
	type: {
		type: String as PropType<'CODELIST' | 'ITEMS'>,
		default: 'CODELIST',
	},
	items: {
		type: Array as PropType<IParam[]>,
		default: () => [],
	},
	codeListTag: {
		type: String,
	},
	context: {
		type: Object as PropType<IContext>,
		default: () => {},
	},
	viewParams: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
};

export function getDefaultSelect(
	items: ICodeListItem[]
): ICodeListItem | undefined {
	return items.find((item: IParam) => item.default);
}
